package com.gyj.server.entity;

import com.gyj.server.core.ServiceInstance;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
 * 最近变化的队列
 * @author Gao
 * @date 2021/6/27
 */
public class RecentlyChangedServiceInstance {

    /**
     * 服务实例
     */
    private ServiceInstance serviceInstance;

    /**
     * 最近变更的时间
     * 或者叫 lastUpdateTime 上一次修改的时间戳
     */
    private Long recentlyChangedTime;

    /**
     * 操作类型，注册、下线删除
     */
    private String operationType;

    /**
     * 内部类构造函数
     * @param serviceInstance
     * @param recentlyChangedTime
     * @param operationType
     */
    public RecentlyChangedServiceInstance(ServiceInstance serviceInstance,
                                          Long recentlyChangedTime,
                                          String operationType) {
        this.serviceInstance = serviceInstance;
        this.recentlyChangedTime = recentlyChangedTime;
        this.operationType = operationType;
    }

    public ServiceInstance getServiceInstance() {
        return serviceInstance;
    }

    public void setServiceInstance(ServiceInstance serviceInstance) {
        this.serviceInstance = serviceInstance;
    }

    public Long getRecentlyChangedTime() {
        return recentlyChangedTime;
    }

    public void setRecentlyChangedTime(Long recentlyChangedTime) {
        this.recentlyChangedTime = recentlyChangedTime;
    }

    public String getOperationType() {
        return operationType;
    }

    public void setOperationType(String operationType) {
        this.operationType = operationType;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
    }
}
